﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FluentNHibernate.Mapping;
using RBAC.DAL.Entities;

namespace RBAC.DAL.Mappers
{
    public class DomainMap : ClassMap<Domain>
    {
        public DomainMap()
        {
            Id(x => x.Id);

            Map(x => x.DomainName).Not.Nullable().Length(255).UniqueKey("UQ_Domain_DomainName");

            Map(x => x.Description).Not.Nullable().Length(255);

            HasMany(x => x.Functions);

            // BaseEntity
            //References(x => x.CreateBy).Cascade.All();
            Map(x => x.CreateById).Nullable();

            Map(x => x.CreateDate).Not.Nullable();

            Map(x => x.IsActive).Not.Nullable();

            Map(x => x.ProjectId).Not.Nullable().UniqueKey("UQ_Domain_DomainName");
        }

    }
}